package com.dongwu.manager.entity;

import com.dongwu.common.entity.BaseEntity;
import com.dongwu.security.entity.User;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;

/**
 * 广告实体类
 * 
 * @author xyj
 *
 */
@Entity
public class Advertising extends BaseEntity<String> {

	private String adName; // 广告名称

	private String adBusinessName; // 商家名称
	
	private String adBusinessAddr; // 商家地址

	private String adImage; // 广告单图

	private String adVideo; // 广告视频地址

	@Column(columnDefinition = "Text") // 广告轮播图
	private String adSlideImage;

	private String adQrcode; // 二维码

	private String adUrl; // 访问路径

	private String adMobilePhone; // 联系方式

	private String adRemark; // 温馨提示
	
	private String appTemplateTypeId; // 模板类别
	
	private String appTemplateTypeSn; // 模板类别唯一编码

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date adStartTime; // 优惠券开始时间

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date adEndTime; // 优惠券结束时间

	@Column(columnDefinition = "Text")
	private String adIntroduction; // 详情

	private String adSlink; // 短网址
	
	private Integer adsType; //0.图片，1.视频，2.分类，3.广告,4.优惠券

	@OneToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "appTemplateId")
	private AppTemplate appTemplate; // 关联模板
	
	@OneToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "productId")
	private Product product; // 关联商品
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "teltemplatelayoutId")
	private Teltemplatelayout teltemplatelayout; // 关联模板布局位置
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "adsclassifyId")
	private AdsClassify adsclassify; // 关联广告分类
	
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "userid")
	private User user; // 关联用户
	
	private StatysType isOpen; // 状态
	
	private DelType isDel; // 是否删除
	
	/**
	 * 广告状态
	 */
	public enum StatysType {
		open, close
	}
	
	/**
	 * 是否删除
	 */
	public enum DelType {
		notdel, del
	}
	
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Integer getAdsType() {
		return adsType;
	}

	public void setAdsType(Integer adsType) {
		this.adsType = adsType;
	}

	public Teltemplatelayout getTeltemplatelayout() {
		return teltemplatelayout;
	}

	public void setTeltemplatelayout(Teltemplatelayout teltemplatelayout) {
		this.teltemplatelayout = teltemplatelayout;
	}

	public AdsClassify getAdsclassify() {
		return adsclassify;
	}

	public void setAdsclassify(AdsClassify adsclassify) {
		this.adsclassify = adsclassify;
	}

	public String getAppTemplateTypeSn() {
		return appTemplateTypeSn;
	}

	public void setAppTemplateTypeSn(String appTemplateTypeSn) {
		this.appTemplateTypeSn = appTemplateTypeSn;
	}

	public String getAppTemplateTypeId() {
		return appTemplateTypeId;
	}

	public void setAppTemplateTypeId(String appTemplateTypeId) {
		this.appTemplateTypeId = appTemplateTypeId;
	}

	public String getAdBusinessName() {
        return adBusinessName;
    }

    public void setAdBusinessName(String adBusinessName) {
        this.adBusinessName = adBusinessName;
    }

    public String getAdBusinessAddr() {
        return adBusinessAddr;
    }

    public void setAdBusinessAddr(String adBusinessAddr) {
        this.adBusinessAddr = adBusinessAddr;
    }

    public String getAdName() {
		return adName;
	}

	public void setAdName(String adName) {
		this.adName = adName;
	}

	public String getAdImage() {
		return adImage;
	}

	public void setAdImage(String adImage) {
		this.adImage = adImage;
	}

	public String getAdVideo() {
		return adVideo;
	}

	public void setAdVideo(String adVideo) {
		this.adVideo = adVideo;
	}

	public String getAdSlideImage() {
		return adSlideImage;
	}

	public void setAdSlideImage(String adSlideImage) {
		this.adSlideImage = adSlideImage;
	}

	public String getAdQrcode() {
		return adQrcode;
	}

	public void setAdQrcode(String adQrcode) {
		this.adQrcode = adQrcode;
	}

	public String getAdUrl() {
		return adUrl;
	}

	public void setAdUrl(String adUrl) {
		this.adUrl = adUrl;
	}

	public StatysType getIsOpen() {
		return isOpen;
	}

	public void setIsOpen(StatysType isOpen) {
		this.isOpen = isOpen;
	}

	public String getAdMobilePhone() {
		return adMobilePhone;
	}

	public void setAdMobilePhone(String adMobilePhone) {
		this.adMobilePhone = adMobilePhone;
	}

	public String getAdRemark() {
		return adRemark;
	}

	public void setAdRemark(String adRemark) {
		this.adRemark = adRemark;
	}

	public Date getAdStartTime() {
		return adStartTime;
	}

	public void setAdStartTime(Date adStartTime) {
		this.adStartTime = adStartTime;
	}

	public Date getAdEndTime() {
		return adEndTime;
	}

	public void setAdEndTime(Date adEndTime) {
		this.adEndTime = adEndTime;
	}

	public String getAdIntroduction() {
		return adIntroduction;
	}

	public void setAdIntroduction(String adIntroduction) {
		this.adIntroduction = adIntroduction;
	}

	public String getAdSlink() {
		return adSlink;
	}

	public void setAdSlink(String adSlink) {
		this.adSlink = adSlink;
	}

	public DelType getIsDel() {
		return isDel;
	}

	public void setIsDel(DelType isDel) {
		this.isDel = isDel;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public AppTemplate getAppTemplate() {
		return appTemplate;
	}

	public void setAppTemplate(AppTemplate appTemplate) {
		this.appTemplate = appTemplate;
	}
}